import random
import sys

print("ROCK","PARER","SCISSORS")

# 设置变量记录输赢情况
wins = 0
losses = 0
ties = 0

# 游戏主循环
while True:
    print("%s Wins, %s Losses, %s Ties" % (wins,losses,ties))
    while True: # 玩家输入选择
        print('Enter your move:(r)ock (p)arer, (s)cissors')
        playerMove = input()
        if playerMove == 'q':
            sys.exit() # 退出程序
        elif playerMove == 'r' or playerMove == 'p' or playerMove == 's':
            break

    # 显示玩家的选择
    if playerMove == 'r':
        print('ROCK versus...')
    elif playerMove == 'p':
        print('PARER versus...')
    elif playerMove == 's':
        print('SCISSORS versus...')

    # 显示计算机随机的选择
    randomNumber = random.randint(1,3)
    if randomNumber == 1:
        computerMove = 'r'
        print('ROCK')
    elif randomNumber == 2:
        computerMove = 'p'
        print('PARER')
    elif randomNumber == 3:
        computerMove = 's'
        print("SCISSORS")

    #展示并记录结果
    if playerMove == computerMove:
        print("It is a tie!")
        ties += 1
    elif playerMove == 'r' and computerMove == 's':
        print("You win!")
        wins += 1
    elif playerMove == 'r' and computerMove == 'p':
        print("You lose!")
        losses += 1
    elif playerMove == 's' and computerMove == 'p':
        print("You win!")
        wins += 1
    elif playerMove == 's' and computerMove == 'r':
        print("You lose!")
        losses += 1
    elif playerMove == 'p' and computerMove == 'r':
        print("You win!")
        wins += 1
    elif playerMove == 'p' and computerMove == 's':
        print("You Lose!")
        losses += 1